$(document).ready(function(){
var listOfNames = ["hola", "hoola", "hooola"];

   $("#tbxName").autocomplete(listOfNames, {
        matchContains:false,
        minChars:1, 
        autoFill:false,
        mustMatch:false,
        cacheLength:20,
        max:20
    });
    $("#tbxName").blur(function(){
        if(!listOfNames.containsCaseInsensitive(this.value)){
          alert("Invalid name entered");
        }
    });        


Array.prototype.containsCaseInsensitive = function(obj) {
  var i = this.length;
  while (i--) {
        if (this[i].toUpperCase() === obj.toUpperCase()) {
          return true;
        }
  }
  return false;
};

   $("#tbxName").result(function(event, data, formatted) {
        var u = this;
        // Check value here

    });
});

